<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <script src="jquery-1.11.3.min.js"></script>
 </head>
 <body>
    <h1 name="name1">aaaaaaaaaaaa</h1>
	<h1 name="name1">AAAAAAAAAAAA</h1>
	<h1 name="name2">bbbbbbbbbbbb</h1>
	<h1 name="name3">cccccccccccc</h1>
	<h1 name="name4" id="name4">dddddddddddd</h1>
	<h1>eeeeeeeeeeee</h1>
 </body>
 <script>
   //找到含有name属性的元素
   $('h1[name]').css({'color':'red'});
   //找到含有name属性等于name1的元素
   $('h1[name = name1]').css({'color':'red'});
   //找到含有name属性等于以name开头的元素
   $('h1[name ^= name]').css({'color':'red'});
   //找到含有name属性等于以name结尾的元素
   $('h1[name $= 1]').css({'color':'red'});
   //找到含有name属性值中有m字符的元素
   $('h1[name *= m]').css({'color':'red'});
   //找到含有name属性不等于name1开头的元素
   $('h1[name != name1]').css({'color':'red'});
   //找到同时含有name属性和id属性的元素
   $('h1[name][id]').css({'color':'red'});
 </script>
</html>
